package panel.help
{
	import flash.display.Bitmap;
	import flash.display.Sprite;
	import flash.display.Stage;
	import flash.text.TextField;
	import flash.text.TextFormat;
	
	import assists.HtmlText;
	import assists.TextFieldUtils;
	import assists.resource.ResourceLoader;
	
	public class ReadyItem extends Sprite
	{
		private var _loader:ResourceLoader;
		private var _stage:Stage;
		private var _title:TextField = new TextField();
		private var _content:TextField = new TextField();

		private var _backGround:Bitmap;
		public function ReadyItem(stage:Stage,loader:ResourceLoader)
		{
			_loader = loader;
			_stage = stage;
			
			_title.mouseEnabled = false;
			_title.autoSize = "left";
			
			
			_backGround = _loader.uiManager.generateBmp(_loader.uiManager.blueBack,true);
			_backGround.width = _stage.stageWidth * 0.9;
			_backGround.x = _stage.stageWidth * 0.05;
			
			_content.width = _backGround.width ;
			_content.mouseEnabled = false;
			_content.multiline = true;
			_content.wordWrap = true;
			var style:TextFormat = new TextFormat();
			style.leading = 8;
			_content.defaultTextFormat = style;
			_content.autoSize = "left";
		}
		
		public function show(data:Object):void
		{
			TextFieldUtils.setHtmlText(_title,HtmlText.format(data.name,0xffffff,20));
			TextFieldUtils.setHtmlText(_content,HtmlText.format(data.content,0xffffff));
			
			_title.x = (_backGround.width - _title.width) * 0.5;
			_title.y = (_backGround.height - _title.height) * 0.5;
			
			_content.x = _backGround.x;
			_content.y = _backGround.y + _backGround.height * 1.1;
			
			this.addChild(_backGround);
			this.addChild(_title);
			this.addChild(_content);
		}
		
	}
}